package com.tjbklx1.thread.chap02.demo02;

import java.util.List;

public class ReadThread extends Thread{
	private final List<Integer> list;

	ReadThread(List<Integer> list) {
		this.list = list;
	}

	@Override
	public void run() {
		while(true) {
			for(int n: list){
				System.out.println(n);
			}
		}
	}
	
	//同步改造
//	@Override
//	public void run() {
//		while (true) {
//			synchronized (list) {
//				for (int n : list) {
//					System.out.println(n);
//				}
//			}
//		}
//	}
}
